import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import '@/assets/css/global.css'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import VueLazyload from 'vue-lazyload'
import moment from 'moment'
import axios from 'axios'
Vue.use(VueLazyload)
Vue.use(ElementUI)

Vue.config.productionTip = false
// 时间戳转年月日
Vue.filter('dateFormat', (dateStr, pattern = 'YYYY-MM-DD') => {
  return moment(dateStr).format(pattern)
})

// 毫秒转分秒
Vue.filter('dateFormat2', function(originVal) {
  let min = parseInt(originVal / (1000 * 60))
  let sec = Math.round((originVal % (1000 * 60)) / 1000)
  if (sec < 10) {
    sec = '0' + sec
  }
  return `${min}:${sec}`
})

new Vue({
  router,
  // store挂载到vue实例中
  store,
  render: h => h(App)
}).$mount('#app')
